package site.marqstree.latte.ec.main.index.search;

/*
 * 项目名: EleCommerce
 * 包名: site.marqstree.latte.ec.main.index.search
 * 文件名: SearchAdapter
 * 创建者: marqstree
 * 创建时间: 2020/2/9 16:54
 * 描述: TODO
 */

import android.widget.TextView;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.List;

import site.marqstree.latte.ec.R;
import site.marqstree.latte.ui.recycler.MultipleFields;
import site.marqstree.latte.ui.recycler.MultipleItemEntity;
import site.marqstree.latte.ui.recycler.MultipleRecyclerAdapter;

public class SearchAdapter extends MultipleRecyclerAdapter {

    protected SearchAdapter(List<MultipleItemEntity> data) {
        super(data);
        addItemType(SearchItemType.ITEM_SEARCH, R.layout.item_search);
    }

    @Override
    protected void convert(BaseViewHolder holder, MultipleItemEntity entity) {
        super.convert(holder, entity);
        switch (entity.getItemType()) {
            case SearchItemType.ITEM_SEARCH:
                final TextView tvSearchItem = holder.getView(R.id.tv_search_item);
                final String history = entity.getField(MultipleFields.TEXT);
                tvSearchItem.setText(history);
                break;
            default:
                break;
        }
    }
}
